package com.adaptor.motherboard;

import com.adaptor.cpu.CPU;
import com.adaptor.gpu.GPU;

public abstract class MotherBoard {
    private final CPU cpu;
    private final String model;
    private final String brand;
    private final GPU gpu;

    public MotherBoard(CPU cpu, String model, String brand, GPU gpu) {
        this.cpu = cpu;
        this.model = model;
        this.brand = brand;
        this.gpu = gpu;
    }
    public void run() {
        check(cpu, gpu);
        System.out.println("MotherBoard is: " + brand + "-" +model);
        System.out.println("CPU name: " + cpu.getName());
        System.out.println("GPU name: " + gpu.getName());
    }

    void check(CPU cpu, GPU gpu) {
        boolean result = cpu.checkRejectionReaction(gpu.getBrand());
        if (result) System.err.println("当前CPU: " + cpu.getName() + " 不兼容当前GPU: " + gpu.getName());
    }
}
